from mailing import send_mail_cse_smtp

if __name__ == "__main__":
    from sys import argv
    if len(argv) == 2 and argv[1] == "confirmsend":
        testing = False
    else:
        testing = True

    ids = {"1155113386": "SURYADINATA, Aaron Timothy",
           "1155122022": "TANRYO, Nicholas",
           "1155110243": "CHOI, Pui Ying"}

    for id in ids.keys():
        receiver = [id+"@link.cuhk.edu.hk"]
        cc = ['lyu@cse.cuhk.edu.hk', 'csci3100@cse.cuhk.edu.hk']
        subject = "[IMPORTANT] Punishment for Cheating in CSCI3100 Final Exam"
        text = f'''Dear {ids[id]} {id},

This is to inform you that we have found you cheating in CSCI3100 Final Exam. It is because we have created different versions of question papers with very minor changes and some of your solutions are inconsistent with the version assigned to you. There is a clear evidence that these answers came from answers intended for another version of the paper, not the version you were supposed to work on.

You have signed the declaration of academic honesty for online exams, and Prof. Lyu has repeated many times that cheating will be seriously punished. After a careful discussion, we have decided to give you a zero mark for the final exam. However, Prof. Lyu will still give you a D grade to pass this course.  This is already a punishment with reduced penalty. Hope you would not cheat anymore.

If you accept this punishment, we will not report your case. Otherwise, Prof. Lyu will refer your case to the discipline committee for further investigation.  The punishment will be more severe if you are found guilty by the committee.

Please respond before 31 May regarding your agreement or disagreement with this decision.

Regards,
3100 Tutor Team

'''
        if testing:
            print(receiver)
            print(subject)
            print(text)
            print(cc)
        else:
            send_mail_cse_smtp('csci3100', subject, text, None, receiver, cc, None)
            print(f'Sent mail to {id}')
